var _Container = require('component/container.js');
var _inherit = require('core/inherit.js');
var _layout = require('tools/layout.js');
var _relative = _layout.relative;

var _global = require('global/global.js');
var R = require('res/texture.js').R;
var S = require('res/style.js');

// ==========================
// Title
// ==========================
function Title(text) {
    _Container.call(this);

    this.addChild(this.mText = S.confirm.title.createText(text));
    this.mText.setAnchor(0.5, 0.5);
    this.setSize(480, 163);

    _relative.local.layoutTo(this.mText, 0.5, 0.5, this, 0.5, 0.5);
}
_inherit(Title, _Container);

// ==========================
// Message
// ==========================
function Message(text) {
    _Container.call(this);

    this.setSize(432, 168);
    var bg = _global.ninePatchNode(R.dialog.bg, 'all', 15, 15, 15, 15);
    bg.setSize(432, 168);
    this.addChild(bg);
    this.addChild(this.mText = S.confirm.message.createText(text));
    this.mText.setAnchor(0.5, 0.5);

    _relative.local.layoutTo(this.mText, 0.5, 0.5, this, 0.5, 0.5, 0, 4);
}
_inherit(Message, _Container);

exports.createTitle = function (text) {
    return new Title(text);
};
exports.createMessage = function (text) {
    return new Message(text);
};